package com.example.luke.shengdangxiaoattendance.Model;

import com.example.luke.shengdangxiaoattendance.Database.DingHanDB;
import com.example.luke.shengdangxiaoattendance.Util.GlobalFunction;

import java.util.Date;

/**
 * Created by luke on 31/05/2017.
 */

public class App {

    private static  App obj;
    public static App getInstance(){
        if (obj==null){
            obj= new App();

        }
        return obj;

    }


    public String temperature;
    public String climate;
    public String airDirection;
    public Student selectedStudent;
    public Course currentCourse;

    public String totalStudent;

    public String preStudent;
    public String classTime;

    public  int getTotalStudentForCurrentClass(String className){
        int temp=0;
        if (currentCourse.className!=null){
            String date=GlobalFunction.convertDate(new Date(),"yyyy-MM-dd");




                int count=  DingHanDB.getInstance(GlobalFunction.context).getCorrespondingAttendanceList(className.trim(),date,currentCourse.Time);

                temp=temp+count;


        }


        return temp;
    }
}
